<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{.item.Title}} - 商品详情</title>
<!--    <link rel="stylesheet" href="/static/css/item_detail.css"> &lt;!&ndash; 可选样式 &ndash;&gt;-->
    <style>
        .seller-info {
            margin-top: 20px;
            padding: 16px;
            border: 1px solid #ddd;
            border-radius: 8px;
            background-color: #f9f9f9;
        }

        .seller-info h2 {
            font-size: 1.2em;
            margin-bottom: 10px;
        }

        .seller-info p {
            margin: 6px 0;
        }

        .avatar img {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            object-fit: cover;
            border: 1px solid #ccc;
        }
    </style>
</head>
<body>
<!-- 展示发布者信息 -->
<div class="seller-info">
    <h2>卖家信息</h2>
    <p><strong>用户名：</strong>{{.user.Username}}</p>
    <p><strong>邮箱：</strong>{{.user.Email}}</p>
    <p><strong>简介：</strong>{{.user.Intro}}</p>
    <p><strong>性别：</strong>{{.user.Gender}}</p>
    <p><strong>生日：</strong>{{.user.Birthday}}</p>
    <p><strong>偏好：</strong>{{.user.Prefer}}</p>
    <p><strong>书院：</strong>{{.user.University}}</p>
    <p><strong>芝麻信用：</strong>{{.user.ZhimaCredit}}</p>
    <div class="avatar">
        <img src="{{.user.UserImg}}" alt="头像" class="avatar-img">
    </div>
</div>
<div class="detail-container">
    <h1>{{.item.Title}}</h1>
    <p><strong>价格：</strong>￥{{.item.Price}}</p>
    <p><strong>类别：</strong>{{index .catMap .item.Category}}</p><!-- 如果传递了 catMap -->
    <p><strong>描述：</strong>{{.item.Detail}}</p>
    <div class="image-section">
        <img src="{{.item.Image}}" alt="商品图片" onerror="this.src='/static/img/default.jpg'">
    </div>
    <button onclick="window.history.back()">返回</button>
</div>
<!-- 商品详情页面底部 -->
<form id="addToCartForm" action="/add_to_cart" method="POST">
    <input type="hidden" name="itemId" value="{{.item.ID}}">
    <input type="hidden" name="shopname" value="{{.user.Username}}">
    <input type="hidden" name="type" value="{{index .catMap .item.Category}}">
    <input type="hidden" name="price" value="{{.item.Price}}">
    <input type="number" name="quantity" value="1" min="1">
    <button type="submit">加入购物车</button>
</form>


</body>
</html>
